<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
<!-- 编辑器公式插件 -->
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/addKityFormulaDialog.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/getKfContent.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/defaultFilterFix.js"></script>
<div class="span10" id="datacontent">

    <ul class="breadcrumb">
        <li><a href="/exercise/index/index"></a> 剑雅真题<span class="divider">/</span></li>
        <li><a href="/exercise/speak/index">口语练习</a> <span class="divider">/</span></li>
        <li class="active">修改题目</li>
    </ul>
    <form action="/exercise/speak/update" method="post" class="form-horizontal">
        <fieldset>
            <div class="control-group">
                <label for="area" class="control-label">选择剑雅：</label>
                <div class="controls">
                    <select name="cate_id" id="">
                        <?php $catId = isset($data->cate_id)?$data->cate_id:(isset($cate_id)?$cate_id:'')?>
                        <?php foreach ($datalist as $k => $v): ?>
                            <option <?php echo $catId==$v['cate_id'] ? "selected=selected" : ""?> value="<?php echo $v['cate_id']?>"><?php echo $v['name']?></option>

                        <?php endforeach ?>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">名称：</label>
                <div class="controls">
                    <input type="text" value="<?php echo !isset($data->name)?'':$data->name?>" name="name">
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">标题：</label>
                <div class="controls">
                    <input value="<?php echo !isset($data->title)?'':$data->title?>" type="text" name="title">
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">标题图片：</label>
                <div class="controls">
                    <input type="text" value="<?php echo !isset($data->title_image)?'':$data->title_image?>" class="title_image" name="title_image">
                    <a href="#" class="btn btn-info" onclick="upImage2()">上传文件</a>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">题目描述：</label>
                <div class="controls" >
                    <textarea id="sss" name="description"><?php echo isset($data->description)?$data->description:isset($data->item)?$data->item:''?></textarea>

                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">浏览量：</label>
                <div class="controls">
                    <input value="<?php echo !isset($data->viewCount)?'':$data->viewCount?>" type="text" name="viewCount">
                </div>
            </div>
            <div class="control-group">
                <div class="controls">
                    <button class="btn btn-primary" type="submit">提交</button>
                    <input type="hidden" name="id" value="<?php echo $id?>"/>
                </div>
            </div>
        </fieldset>
    </form>
</div>
<script>
    //实例化编辑器
    // 标题图片
    var o_ueditorupload2 = UE.getEditor('j_ueditorupload2',
        {
            autoHeightEnabled:false
        });

    o_ueditorupload2.ready(function ()
    {

        o_ueditorupload2.hide();//隐藏编辑器

        //监听图片上传
        o_ueditorupload2.addListener('beforeInsertImage', function (t,arg)
        {
            $('.title_image').val(arg[0].src);

        });

        /* 文件上传监听
         * 需要在ueditor.all.min.js文件中找到
         * d.execCommand("insertHtml",l)
         * 之后插入d.fireEvent('afterUpfile',b)
         */
        o_ueditorupload2.addListener('afterUpfile', function (t, arg)
        {

        });
    });
    //弹出图片上传的对话框
    function upImage2()
    {
        var myImage2 = o_ueditorupload2.getDialog("insertimage");
        myImage2.open();
    }

</script>

<script type="text/plain" id="j_ueditorupload2"></script>
<script>
    //实例化编辑器
    var o_ueditorupload = UE.getEditor('sss',
        {
            autoHeightEnabled:false
        });
</script>
<script type="text/plain" id="sss"></script>
<script type="text/plain" id="sss2"></script>